home *** CD-ROM | disk | FTP | other *** search
- /* (C) Copyright 1991 Dave Fritsche (wb8zxu), All Rights Reserved.
- *
- * Redistribution and use in source and binary forms are permitted for
- * non-commercial use, provided that the above copyright notice and this
- * paragraph are duplicated in all such forms. THIS SOFTWARE IS PROVIDED
- * ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
- * WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE.
- */
- /*bdoc
- * Function "PUTCUR"
- *
- * Written: Dave Fritsche
- * Date: July, 1987
- *
- * A function to position the cursor on the screen. Syntax:
- * putcur(x, y)
- * where "x" is the column number of the screen and "y" is the line
- * number.
- edoc*/
-
- #include <stdio.h>
-
- #define BIOS
-
- #ifdef BIOS
- #include <dos.h>
-
- #define VIDEO_IO 0x10
- #define SETPOS 0x02
- #endif
-
- putcur(x, y)
- int x, y;
- {
- #ifdef BIOS
- union REGS in_regs, out_regs;
- #endif
-
- if (x > 80) x = 80;
- if (y > 25) y = 25;
- if (x < 1 ) x = 1;
- if (y < 1 ) y = 1;
-
- #ifdef BIOS
- in_regs.h.ah = SETPOS;
- in_regs.h.bh = 0;
- in_regs.h.dh = y - 1;
- in_regs.h.dl = x - 1;
- int86(VIDEO_IO, &in_regs, &out_regs);
- #else
- printf("%c[%d;%dH", 27, y, x);
- #endif
- }
-